import unittest
from common.base import open_browser
from scripts.register_script import RegisterScript
from common.base import Base
from common.register_data1 import RegisterData
import ddt
# 准备测试数据

class TestRegister(unittest.TestCase):
    def setUp(self):
        """打开浏览器登录页面"""
        self.driver = open_browser()
        self.register = RegisterScript(self.driver)
        self.base = Base(self.driver)
        self.rd = RegisterData()
    def test_register(self,):
        """注册全部填写"""
        data = self.rd.all_data()#全部的填写
        self.register.register_all(data)

        try:
        # 验证注册是否成功
            result = self.register.is_login_success(data["username"])
            self.assertTrue(result)
        except:
            return result
    def test2(self):
        '''部分填写'''
        data=self.rd.all_data()#全部的填写
        self.register.register_required(data)

        # 验证注册是否成功
        result = self.register.is_login_success(data["username"])
        self.assertTrue(result)
        return result

    def test3(self):
        '''我已经看过'''
        self.register.click_look_text()

    def test4(self):
        self.register.click_password()
            #已经有账户
    def test5(self):
        #忘记密码
        self.register.clikc_password4()

    def tearDown(self):

        self.base.close_browser()

if __name__ == '__main__':
    unittest.main()
